package com.example.booksystem.controller;

import com.example.booksystem.model.BookInfo;
import com.example.booksystem.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//controller调用service
@RequestMapping("/book")
@RestController
public class BookController {
    @Autowired //依赖注入
    private BookService bookService;//移动至此方便后续增加功能

//    public BookController(BookService bookService) {
//        this.bookService = bookService;
//    }

    @RequestMapping("/getList")
    public List<BookInfo> getList() {
//        List<BookInfo> list = bookService.getList();
        return bookService.getList();
    }
}
